home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / gutenprint / util.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-03-15  |  5.7 KB  |  184 lines

  1. /*
  2.  * "$Id: util.h,v 1.3.2.2 2007/12/15 20:35:35 rlk Exp $"
  3.  *
  4.  *   libgimpprint utility and miscellaneous functions.
  5.  *
  6.  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
  7.  *    Robert Krawitz (rlk@alum.mit.edu)
  8.  *
  9.  *   This program is free software; you can redistribute it and/or modify it
  10.  *   under the terms of the GNU General Public License as published by the Free
  11.  *   Software Foundation; either version 2 of the License, or (at your option)
  12.  *   any later version.
  13.  *
  14.  *   This program is distributed in the hope that it will be useful, but
  15.  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16.  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  17.  *   for more details.
  18.  *
  19.  *   You should have received a copy of the GNU General Public License
  20.  *   along with this program; if not, write to the Free Software
  21.  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22.  */
  23.  
  24. /**
  25.  * @file gutenprint/util.h
  26.  * @brief Utility functions.
  27.  */
  28.  
  29. #ifndef GUTENPRINT_UTIL_H
  30. #define GUTENPRINT_UTIL_H
  31.  
  32. #include <gutenprint/curve.h>
  33. #include <gutenprint/vars.h>
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if !defined(__GNUC__) && !defined(__attribute__)
  40. #  define __attribute__(x)
  41. #endif /* !__GNUC__ && !__attribute__ */
  42.  
  43. /**
  44.  * Utility functions.
  45.  *
  46.  * @defgroup util util
  47.  * @{
  48.  */
  49.  
  50. /**
  51.  * Initialise libgimpprint.
  52.  * This function must be called prior to any other use of the library.
  53.  * It is responsible for loading modules and XML data and initialising
  54.  * internal data structures.
  55.  * @returns 0 on success, 1 on failure.
  56.  */
  57. extern int stp_init(void);
  58.  
  59. /**
  60.  * Set the output encoding.  This function sets the encoding that all
  61.  * strings translated by gettext are output in.  It is a wrapper
  62.  * around the gettext bind_textdomain_codeset() function.
  63.  * @param codeset the standard name of the encoding, which must be
  64.  * usable with iconv_open().  For example, "US-ASCII" or "UTF-8".  If
  65.  * NULL, the currently-selected codeset will be returned (or NULL if
  66.  * no codeset has been selected yet).
  67.  * @returns a string containing the selected codeset, or NULL on
  68.  * failure (errno is set accordingly).
  69.  */
  70. extern const char *stp_set_output_codeset(const char *codeset);
  71.  
  72. extern stp_curve_t *stp_read_and_compose_curves(const char *s1, const char *s2,
  73.                         stp_curve_compose_t comp,
  74.                         size_t piecewise_point_count);
  75. extern void stp_abort(void);
  76.  
  77. /*
  78.  * Remove inactive and unclaimed options from the list
  79.  */
  80. extern void stp_prune_inactive_options(stp_vars_t *v);
  81.  
  82.  
  83. extern void stp_zprintf(const stp_vars_t *v, const char *format, ...)
  84.        __attribute__((format(__printf__, 2, 3)));
  85.  
  86. extern void stp_zfwrite(const char *buf, size_t bytes, size_t nitems,
  87.             const stp_vars_t *v);
  88.  
  89. extern void stp_putc(int ch, const stp_vars_t *v);
  90. extern void stp_put16_le(unsigned short sh, const stp_vars_t *v);
  91. extern void stp_put16_be(unsigned short sh, const stp_vars_t *v);
  92. extern void stp_put32_le(unsigned int sh, const stp_vars_t *v);
  93. extern void stp_put32_be(unsigned int sh, const stp_vars_t *v);
  94. extern void stp_puts(const char *s, const stp_vars_t *v);
  95. extern void stp_putraw(const stp_raw_t *r, const stp_vars_t *v);
  96. extern void stp_send_command(const stp_vars_t *v, const char *command,
  97.                  const char *format, ...);
  98.  
  99. extern void stp_erputc(int ch);
  100.  
  101. extern void stp_eprintf(const stp_vars_t *v, const char *format, ...)
  102.        __attribute__((format(__printf__, 2, 3)));
  103. extern void stp_erprintf(const char *format, ...)
  104.        __attribute__((format(__printf__, 1, 2)));
  105. extern void stp_asprintf(char **strp, const char *format, ...)
  106.        __attribute__((format(__printf__, 2, 3)));
  107. extern void stp_catprintf(char **strp, const char *format, ...)
  108.        __attribute__((format(__printf__, 2, 3)));
  109.  
  110. #define STP_DBG_LUT         0x1
  111. #define STP_DBG_COLORFUNC    0x2
  112. #define STP_DBG_INK        0x4
  113. #define STP_DBG_PS        0x8
  114. #define STP_DBG_PCL        0x10
  115. #define STP_DBG_ESCP2        0x20
  116. #define STP_DBG_CANON        0x40
  117. #define STP_DBG_LEXMARK            0x80
  118. #define STP_DBG_WEAVE_PARAMS    0x100
  119. #define STP_DBG_ROWS        0x200
  120. #define STP_DBG_MARK_FILE    0x400
  121. #define STP_DBG_LIST        0x800
  122. #define STP_DBG_MODULE        0x1000
  123. #define STP_DBG_PATH        0x2000
  124. #define STP_DBG_PAPER        0x4000
  125. #define STP_DBG_PRINTERS    0x8000
  126. #define STP_DBG_XML        0x10000
  127. #define STP_DBG_VARS        0x20000
  128. #define STP_DBG_OLYMPUS        0x40000
  129. #define STP_DBG_CURVE        0x80000
  130. #define STP_DBG_CURVE_ERRORS    0x100000
  131. #define STP_DBG_PPD        0x200000
  132.  
  133. extern unsigned long stp_get_debug_level(void);
  134. extern void stp_dprintf(unsigned long level, const stp_vars_t *v,
  135.             const char *format, ...)
  136.        __attribute__((format(__printf__, 3, 4)));
  137. extern void stp_deprintf(unsigned long level, const char *format, ...)
  138.        __attribute__((format(__printf__, 2, 3)));
  139. extern void stp_init_debug_messages(stp_vars_t *v);
  140. extern void stp_flush_debug_messages(stp_vars_t *v);
  141.  
  142.  
  143. extern void *stp_malloc (size_t);
  144. extern void *stp_zalloc (size_t);
  145. extern void *stp_realloc (void *ptr, size_t);
  146. extern void stp_free(void *ptr);
  147.  
  148. #define STP_SAFE_FREE(x)            \
  149. do                        \
  150. {                        \
  151.   if ((x))                    \
  152.     stp_free((char *)(x));            \
  153.   ((x)) = NULL;                    \
  154. } while (0)
  155.  
  156. extern size_t stp_strlen(const char *s);
  157. extern char *stp_strndup(const char *s, int n);
  158. extern char *stp_strdup(const char *s);
  159.  
  160. /**
  161.  * Get the library version string (x.y.z)
  162.  * @returns a pointer to the version name of the package, which must not
  163.  * be modified or freed.
  164.  */
  165. extern const char *stp_get_version(void);
  166.  
  167. /**
  168.  * Get the library release version string (x.y)
  169.  * @returns a pointer to the release name of the package, which must not
  170.  * be modified or freed.
  171.  */
  172. extern const char *stp_get_release_version(void);
  173.  
  174. /** @} */
  175.  
  176. #ifdef __cplusplus
  177.   }
  178. #endif
  179.  
  180. #endif /* GUTENPRINT_UTIL_H */
  181. /*
  182.  * End of "$Id: util.h,v 1.3.2.2 2007/12/15 20:35:35 rlk Exp $".
  183.  */
  184.